package com.star.blog.controller;


import com.star.blog.common.Result;
import com.star.blog.service.SysUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 聂建强
 * @since 2021-11-20
 */
@RestController
@RequestMapping("/users")
public class UsersController {

    @Resource
    private SysUserService sysUserService;

    /**
     * 登录后获取用户信息
     * @param token
     * @return
     */
    @GetMapping("/currentUser")
    public Result currentUser(@RequestHeader("Authorization") String token){
        return sysUserService.findUserByToken(token);
    }


}

